package bubblesort

func BubbleSort(values []int) {
    flag := true

    length := len(values)
    for i := 1; i < length; i++ {
        flag = true
        for j := 0; j < length - i; j++ {
            if values[j] > values[j + 1] {
                flag = false
                values[j], values[j + 1] = values[j + 1], values[j]
            }
        }
        if flag {
            break
        }
    }
}
